<?php
/**
 * Created by PhpStorm.
 * User: 小蛮哼哼哼
 * Email: 243194993@qq.com
 * Date: 2021/12/27
 * Time: 15:09
 * motto: 现在的努力是为了小时候吹过的牛逼！
 */

declare(strict_types=1);

namespace app\api\controller\v1;

use app\api\controller\Base;
use app\common\lib\Show;
use app\common\lib\Status;
use think\Exception;

class Jianyi extends Base
{
    public function addJianyiData()
    {
        $content = $this->request->param('content', '', 'trim');
        if(empty($content)){
            return Show::json_show(Status::mini_error,"请填写");
        }
//        dump($content);exit();
        $data = htmlspecialchars($content);
        try {
            $res = (new \app\common\business\Jianyi())->addData([
                "content" => $data
            ]);
        } catch (\Exception $e) {
            return Show::json_show(Status::mini_error, $e->getMessage());
        }
        if ($res) {
            return Show::json_show(Status::mini_normal, "ok");
        } else {
            return Show::json_show(Status::mini_error, "操作失败");
        }
    }
}